package com.home.common.enums;

import java.util.Arrays;
import java.util.Optional;

/**
 * Copyright (C), 2006-2010, ChengDu ybya info. Co., Ltd.
 * FileName: SleepQualityEnum.java
 * 睡眠质量：优、良、一般、较差、差
 *
 * @author wq
 * @version 1.0.0
 * @Date 2018/09/05 16:11
 */
public enum AppEnvEnum {
    DEV("dev", "开发"),
    TEST("test", "测试"),
    PRE("pre", "预发"),
    PROD("prod", "生产(包含)");

    /**
     * 编码
     */
    private String code;

    /**
     * 含义
     */
    private String name;

    AppEnvEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static AppEnvEnum getAppEnvEnum(String code) {
        Optional<AppEnvEnum> appEnvEnum = Arrays.stream(AppEnvEnum.values()).filter(envEnum -> envEnum.getCode() == code).findFirst();
        return appEnvEnum.orElse(null);
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

}
